/*
day222_2
2020.4.6
*/
#include<iostream>
#include<vector>
using namespace std;

class Solution {
public:
    int findMaxConsecutiveOnes(vector<int>& nums) {
		int res=0;
		
		for(int i=0;i<nums.size();++i)
		{
			while(i<nums.size() && nums[i]==0)
			{
				++i;
			}
			
			int j=i;
			int count=0;
			
			while(j<nums.size() && nums[j]==1)
			{
				++j;
				++count;
			}
			
			if(count>res)
			{
				res=count;
			}
			
			i=j;
		 } 
		 return res;
    }
};

int main()
{
	vector<int> nums={1,1,0,1,1,1};
	Solution s;
	cout<<s.findMaxConsecutiveOnes(nums)<<endl;
	return 0;
}
